package com.ttt.gdfood.service;

import com.ttt.gdfood.entity.Comment;
import com.ttt.gdfood.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CommentService {
    @Autowired
    CommentMapper commentMapper;

    public List<Comment> getAllComment(int note_id){
        return commentMapper.allCommentByUid(note_id);
    }

    public void addComment(Comment comment){
        Date now = new Date();
        comment.setCreate_time(now);

        commentMapper.addComment(comment);
    }
}
